var angular = require('angular');

angular.module('httpServiceModule', []).service('httpService', httpServiceFn);

httpServiceFn.$inject = ['$http', '$q'];

function httpServiceFn($http, $q) {
    this.Request = function (type, url) {
        var res = $q.defer();
        $http({
            method: type,
            url: url
        }).then(function successCallback(response) {
            res.resolve(response.data);
        }, function errorCallback(error) {
            res.reject(error)
        });
        return res.promise;
    }
    return this;
}